{include file="public/header" /}
<link rel="stylesheet" href="/static/admin/css/base.css" media="all">
<style>
    html {
        background-color: #f2f2f2 !important;
    }
    .layui-form-item {
        margin-bottom: 0 !important;
    }
    .underline{
        text-decoration: underline;color: #00a2d4
    }
    tr th:last-child {
        border-right: 0 !important;
    }
    .layui-card-body {

        padding: 10px 1px!important;
    }
    .pagination {
            display: inline-block;
            padding-left: 0;
            margin: 20px 0;
            border-radius: 4px;
        }
        .pagination>li {
            display: inline;
        }
        .pagination>li>a, .pagination>li>span {
            position: relative;
            float: left;
            padding: 6px 12px;
            margin-left: -1px;
            line-height: 1.42857143;
            color: #009688;;
            text-decoration: none;
            background-color: #fff;
            border: 1px solid #ddd;
        }
        .pagination>li:first-child>a, .pagination>li:first-child>span {
            margin-left: 0;
            border-top-left-radius: 4px;
            border-bottom-left-radius: 4px;
        }
        .pagination>.active>a, .pagination>.active>a:focus, .pagination>.active>a:hover, .pagination>.active>span, .pagination>.active>span:focus, .pagination>.active>span:hover {
            z-index: 3;
            color: #fff;
            cursor: default;
            background-color: #009688;;
            border-color: #009688;;
        }
        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0,0,0,0);
            border: 0;
        }
        
    .layui-input-block{width: 50%}
</style>
<body>

<div class="layui-fluid layui-anim-fadein">
    <div class="layui-card">
        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                            
                    <div class="layui-card-body" style=" margin-top:30px;">
                        <table class="layui-table">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>性质名称</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {foreach name="userlist" item="vo"}
                            <tr>
                                <td >{$vo.id}</td>
                                <td >{$vo.title}</td>
                                <td >
                                    
                                    <div class="layui-form">
                                        <div class="layui-form-item">
                                            <div class="layui-input-block">
                                                <input type="checkbox"  data-unitid="{$vo.id}" name="place" {if $vo.place ==1 } checked {/if} lay-filter="filter" value="1" title="是否启用" on>
                                            </div>
                                        </div>
                                    </div>
                                </td>
                                
                            </tr>
                            {/foreach}
                            {empty name="userlist"}
                                <tr>
                                    <td colspan="3" align="center">暂无数据</td>
                                </tr>
                            {/empty}
                            </tbody>
                        </table>
                        
                    </div>
                    <div>
                        {$userlist|raw}
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
<input type="hidden" id="pro_id" value="{$info.id}"/>
</body>
{include file="public/footer" /}
<script>
layui.use(['layer', 'jquery', 'form'], function () {
    var layer = layui.layer,
        $ = layui.jquery,
        form = layui.form;
 
    form.on('checkbox(filter)', function (data) {
        var unitid=$(this).attr('data-unitid');
        var pro_id=$("#pro_id").val();
        var checked='';
        if(data.elem.checked==true){
            checked=0;
        }else{
            checked=1;
        }
        $.post("{:url('placeadd')}",{place_id:unitid,pro_id:pro_id,is_del:checked},function(data,status){
            parent.layer.msg(data.msg, {time: 1000}, function () {
                window.location.reload();
            });
        });
    });


});
</script>
</html>